﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MBS_FoodBooking.Models;

namespace MBS_FoodBooking.Controllers
{
    public class ShopingCartController : Controller
    {
        //
        // GET: /ShoopingCart/

       

        [HttpPost]
        public ActionResult CheckOut(FormCollection form)
        {
            
            ShoppingCartModel cart = (ShoppingCartModel)Session["shoppingCartList"];
            if (form["txtBookingId"] != null)
            {
                cart.BookingId = Convert.ToInt32(form["txtBookingId"]);
            }
            FoodOrder order = new FoodOrder(cart.BookingId, cart.LstShoppingCart.ToString(), cart.Price);
            // TO DO: Fetch show details from db basing on bookingid
            int orderId=order.OrderFood();
            ViewBag.BookingId = cart.BookingId;
            ViewBag.Price = cart.Price;
            ViewBag.shopingCart = cart.LstShoppingCart;
            ViewBag.OrderId = orderId;
            return View();
        }
    }
}
